#include <iostream>
#include <stdlib.h>
using namespace std;

void quickSort(int* num, int begin, int end);
void swap(int& a, int& b)
{
	int tmp = b;
	b = a;
	a = tmp;
}

int main()
{
	int n;
	cin >> n;
	int* num = (int*)malloc(sizeof(int) * n);
	for (int i = 0; i < n; i++)
		cin >> num[i];
		
	quickSort(num, 0, n - 1);
	for (int i = 0; i < n; i++)
		printf("%d ", num[i]);
	cout << endl;
	 
	return 0;
}

void quickSort(int* num, int begin, int end)
{
	if (begin >= end)
		return ;
	int keyi = begin;
	int prev = begin, cur = begin + 1;
	while (cur <= end)
	{
		if (num[cur] < num[keyi])
		{
			prev++;
			if (cur != prev)
				swap(num[prev], num[cur]);
		}
		cur++;
	}
	swap(num[keyi], num[prev]);
	keyi = prev;
	
	quickSort(num, begin, keyi - 1);
	quickSort(num, keyi + 1, end);
}
 
